package com.example.rental.controller;

import com.example.rental.entity.Houseinfo;
import com.example.rental.entity.Power;
import com.example.rental.entity.dto.PowerDto;
import com.example.rental.result.Result;
import com.example.rental.service.PowerService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/menu")
@Api(tags = "权限操作接口文档")

public class PowerController {
    @Autowired
    private PowerService powerService;
    @PostMapping("/search")
    public Result searchPower(@RequestBody PowerDto powerDto){
        Result list = powerService.searchPower(powerDto);
        return list;
    }
    @PostMapping("/add")
    public Result addPower(@RequestBody Power power){
        powerService.addPower(power);
        return Result.ok(power);
    }
    @PostMapping("/update")
    public Result updatePower(@RequestBody Power power){
        powerService.updatePower(power);
        return Result.ok(power);
    }
}
